/*
 * @Date: 2025-04-22 16:01:15
 * @Auth: 873768511@qq.com
 * @LastEditors: 873768511@qq.com
 * @LastEditTime: 2025-09-08 17:47:46
 * @FilePath: \corpus\src\pages\resourceManagement\list\component\BasicInfo\index.tsx
 */
import { Descriptions, } from 'antd';
import Container from '../../hooks';
export default () => {
  const {
    resourceDetail: { data },
    tabKey,
    tabsType,
  } = Container.useContainer();
  const getParseJson = (data: string | undefined) => {
    if (!data) return '-'
    try {
      const arr = JSON?.parse(data)?.map((item: { id: string; name: string }) => item?.name)
      return arr.join('、')
    } catch (error) {
      return data
    }
  }
  if (tabKey === 'file') {
    return (<Descriptions column={2}>
      <Descriptions.Item label="数源部门">{data?.gmtCreate ?? '-'}</Descriptions.Item>
      <Descriptions.Item label="共享原始文件资源数量">{data?.refreshFreqName ?? '-'}</Descriptions.Item>
      <Descriptions.Item label="创建时间"> {data?.baseLibraryName ?? '-'}</Descriptions.Item>
      <Descriptions.Item label="共享原始文件数量">{getParseJson(data?.apps)}</Descriptions.Item>
      <Descriptions.Item label="更新时间">{data?.sensitiveLevel ?? '-'}</Descriptions.Item>
      <Descriptions.Item label="部门知识库数量">{data?.createNick ?? '-'}</Descriptions.Item>
      <Descriptions.Item label="资源类型">{data?.syncTime ?? '-'}</Descriptions.Item>
      <Descriptions.Item label="公共知识库数量">{data?.syncTime ?? '-'}</Descriptions.Item>
    </Descriptions>)
  } else {
    return (<Descriptions column={1}>
      <Descriptions.Item label="数源部门">{data?.gmtCreate ?? '-'}</Descriptions.Item>
      <Descriptions.Item label="创建时间"> {data?.baseLibraryName ?? '-'}</Descriptions.Item>
      <Descriptions.Item label="更新时间">{data?.sensitiveLevel ?? '-'}</Descriptions.Item>
      <Descriptions.Item label="资源类型">{data?.syncTime ?? '-'}</Descriptions.Item>
    </Descriptions>)
  }
};
